package com.heys.demo;

public class Queue {

    private int queueLen = 16;

    private int enter = 0;

    private int outer = 0;

    private Integer[] queue_ = new Integer[queueLen];

    public void enterQueue(int data){
        if (enter==queueLen){
            throw new RuntimeException("队列已经满了");
        }
        queue_[enter] =data;
        enter++;
    }

    private int outQueue(){
        if (outer==enter){
            enter=0;
            outer =0;
            throw new RuntimeException("队列是空队列");
        }
        int data = queue_[outer];
        queue_[outer] =null;
        outer++;
        return data;
    }
}
